package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 * 基于字符转换流从文件读取字符数据
 */
public class InputStreamReadDemo02 {
    public static void main(String[] args) throws IOException {
        //1.创建字符转换流对象
        InputStreamReader isr =
                new InputStreamReader(
                        new FileInputStream("./osw.txt"),
                        StandardCharsets.UTF_8);
        //2.读数据
        int data = 0;
        while ((data=isr.read())!=-1){
            System.out.println((char)data);
        }
        //3.关闭流
        isr.close();
    }
}
